﻿using System;
using System.Windows.Forms;

namespace FWF.Logging.Viewer
{
    /// <summary>
    /// 
    /// </summary>
    public partial class frmFind : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="frmFind"/> class.
        /// </summary>
        public frmFind()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Gets or sets the find text.
        /// </summary>
        /// <value>The find text.</value>
        public string FindText
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value indicating whether [ignore case].
        /// </summary>
        /// <value><c>true</c> if [ignore case]; otherwise, <c>false</c>.</value>
        public bool IgnoreCase
        {
            get;
            set;
        }

        /// <summary>
        /// Handles the Load event of the frmFind control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void frmFind_Load( object sender, EventArgs e )
        {
            txtFind.Text = FindText;
            chkIgnoreCase.Checked = IgnoreCase;
        }

        /// <summary>
        /// Handles the Shown event of the frmFind control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void frmFind_Shown( object sender, EventArgs e )
        {

            txtFind.Focus();
        }


        /// <summary>
        /// Handles the Click event of the btnFind control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnFind_Click( object sender, EventArgs e )
        {
            FindText = txtFind.Text;
            IgnoreCase = chkIgnoreCase.Checked;

            DialogResult = DialogResult.OK;
            Close();
        }

    }
}
